﻿using NMock2.Syntax;

namespace NMock2.Internal
{
	internal class PropertyArgumentBuilder<TResult> : IAutoArgumentSyntax<TResult>
	{
		private readonly ExpectationBuilder _builder;

		public PropertyArgumentBuilder(ExpectationBuilder builder)
		{
			_builder = builder;
		}

		public ICommentSyntax WillReturn(TResult actualValue)
		{
			return _builder.Will(Return.Value(actualValue));
		}

		public void Comment(string comment)
		{
			_builder.Comment(comment);
		}

		public ICommentSyntax Will(params IAction[] actions)
		{
			return _builder.Will(actions);
		}

		public IAutoActionSyntax<TResult> Matching(Matcher matcher)
		{
			_builder.Matching(matcher);

			return this;
		}

		public IAutoMatchSyntax<TResult> With(params object[] expectedArguments)
		{
			_builder.With(expectedArguments);

			return new PropertyMatchBuilder<TResult>(_builder);
		}

		public IAutoMatchSyntax<TResult> WithNoArguments()
		{
			return new PropertyMatchBuilder<TResult>(_builder);
		}

		public IAutoMatchSyntax<TResult> WithAnyArguments()
		{
			_builder.WithAnyArguments();

			return new PropertyMatchBuilder<TResult>(_builder);
		}
	}
}
